# -*- coding: UTF-8 -*- 
import random

class blocRessource():
    def __init__(self,id,qte,x,y):
        self.id=id
        self.qte=qte
        self.x=x
        self.y=y
        self.isVisite=True
        self.isChange=False
        self.isAffiche=True
        

class Ressource():
    def __init__(self,type,qte,hauteur,largeur): 
        self.type=type
        self.qte=qte      #random.randint(5000,20000)
        self.listeBlocs=[]
        self.largeur=largeur
        self.hauteur=hauteur
        self.creerBlocs()

    
    def creerBlocs(self):
        x=random.randint(0,self.largeur)
        y=random.randint(0,self.hauteur)
        self.listeBlocs.append(blocRessource(0,self.qte%1000,x,y))
        
        for i in range(int(self.qte/1000)):
            occ=True
            while(occ):
                occ=False
                for j in self.listeBlocs:  
                    if(j.x == x and j.y == y):
                        x=random.randint(0,self.largeur)
                        y=random.randint(0,self.hauteur)
                        occ=True
                        break
                        
            self.listeBlocs.append(blocRessource(i+1,1000,x,y))
        
     